package com.microtf.inscription.web.controller;

import com.microtf.inscription.jpa.entity.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Optional;

@Controller
public class IndexController extends BaseController{

    @RequestMapping("/")
    @ResponseBody
    public String index(){
        Optional<User> loginUser = getLoginUser();
        if(loginUser.isPresent()){
            return loginUser.get().getUsername();
        }else{
            return "no Login";
        }
    }
}
